/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package parser.nodes;

import codegen.CodeGen;
import scanner.Token;

// Read = READ [Prompt]
// Prompt = string
public class ReadNode extends Node {
    private Token prompt;

    public ReadNode(Token prompt) {
        this.prompt = prompt;
    }
    
    public ReadNode() {}
    
    @Override
    public void print() {
        p("Read:");
        indent();
        p("READ");
        if (prompt != null)
            p(prompt);
        unindent();
    }

	@Override
	public void abstractPrint() {
		p("READ");
		indent();
		p(prompt);
		unindent();
	}

	@Override
	public void compile(CodeGen c) throws CompileError {
		if (prompt != null)
			c.outstr("READ, " + prompt.toString());
		else
			c.outstr("READ");
	}
	
	
}
